package com.dong.policy.controller;

import com.dong.common.ResultData;
import com.dong.policy.entity.mysql.policy.Policy;
import com.dong.policy.service.policy.PolicyService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhaodongchao
 * @date 2020/11/12 10:49
 */
@RestController
@RequestMapping("/policy")
public class PolicyController {
    private final PolicyService policyService;

    public PolicyController(PolicyService policyService) {
        this.policyService = policyService;
    }

    @GetMapping("/find/{id}")
    public ResultData<Policy> findPolicy(@PathVariable("id") Long id) {
        return ResultData.ok(policyService.getPolicy(id));
    }
}
